<?php $this->import('Header') ?>
<?php $this->addCss('jcrop/css/jquery.Jcrop.min.css') ?>
<div class="user-zone">
	<div class="container show-zone">
		<div class="row">
			<div class="col-xs-3 col-xs-offset-2">
				<div class="photo">
					<img id="js-dog-photo" src="<?php echo !empty($userInfo['Photo']) ? \Util\User::getUserPhoto($userInfo['Photo'], 200, 200) : '/Resource/images/nohead_new.jpg'; ?>" />
				</div>
				<div class="msg">
					<a id="js-dog-photo-a" href="javascript:;">上传头像</a>
					<iframe name="fileUploadIFrame" class="hidden" src="/User/Upload"></iframe>
				</div>
			</div>
			<div class="col-xs-7 ">
				<h3 class="text-danger">编辑我的资料</h3>
				<h5 class="text-info">详细的资料有助于找到好的小狗狗哦</h5>
				<form class="form-inline add-dog" method="post">
					<?php if (!empty($success)) { ?>
					<div class="alert alert-success" role="alert">
						<strong><?php echo $success ?></strong>
					</div>
					<?php } ?>
					<?php if (!empty($error)) { ?>
						<div class="alert alert-danger" role="alert">
							<?php foreach($error as $v) { ?>
								<strong><?php echo $v ?></strong><br />
							<?php } ?>
						</div>
					<?php } ?>
					<input type="hidden" name="photo" value="" />
					<div class="form-group">
						<label><span class="red">*</span> 狗狗名字：</label>
						<input type="text" name="dogName" value="<?php echo !empty($userInfo['Username']) ? $userInfo['Username'] : '' ?>" class="form-control" placeholder="狗狗的名字">
					</div>
					<div class="clearfix"></div>
					<div class="form-group">
						<label><span class="red">*</span> 选择品种：</label>
						<input type="text" name="breed" value="<?php echo !empty($userInfo['breed']) ? $userInfo['breed'] : '' ?>" id="js-input-breed" class="form-control breed" placeholder="选择品种">
					</div>
					<div class="clearfix"></div>
					<div class="form-group">
						<label><span class="red">*</span> 性别：</label>
						<label>
							<input type="radio" name="sex" checked value="2"> MM&nbsp;&nbsp;&nbsp;&nbsp;
						</label>
						<label>
							<input type="radio" name="sex" <?php echo $userInfo['Sex'] == 1 ? 'checked' : '' ?> value="1"> GG
						</label>
					</div>
					<div class="clearfix"></div>
					<div class="form-group">
						<input type="hidden" name="city" value="<?php echo $userInfo['City'] ?>">
						<label class="city-title-label">我的家乡：</label>
						<label><div class="" id="city"></div></label>
					</div>
					<div class="clearfix"></div>
					<div class="form-group">
						<label>是否绝育：</label>
						<label><input name="sterilization" <?php echo $userInfo['Sterilization'] == 1 ? 'checked' : '' ?> value="1" type="checkbox"> 是</label>
					</div>
					<div class="clearfix"></div>
					<div class="form-group" id="birthday">
						<label>生日：</label>
						<select class="form-control" def="<?php echo date('Y', $userInfo['Birthday']) ?>" name="y" id="birthday-y">
							<option>年</option>
						</select>
						<select class="form-control" def="<?php echo date('m', $userInfo['Birthday']) ?>" name="m" id="birthday-m">
							<option>月</option>
						</select>
						<select class="form-control" def="<?php echo date('d', $userInfo['Birthday']) ?>" name="d" id="birthday-d">
							<option>日</option>
						</select>
					</div>
					<div class="clearfix"></div>
					<div class="form-group">
						<label>婚姻状况：</label>
						<label><input type="radio" checked name="hasChildren" value="<?php echo \Data\User::HAS_CHILDREN_KEEP ?>"> 保密</label>&nbsp;&nbsp;&nbsp;&nbsp;
						<label>
							<input type="radio" <?php echo $userInfo['Sterilization'] == \Data\User::HAS_CHILDREN_YES ? 'checked' : '' ?> name="hasChildren" value="<?php echo \Data\User::HAS_CHILDREN_YES ?>"> 已育过&nbsp;&nbsp;&nbsp;&nbsp;
						</label>
						<label>
							<input type="radio" <?php echo $userInfo['Sterilization'] == \Data\User::HAS_CHILDREN_NO ? 'checked' : '' ?> name="hasChildren" value="<?php echo \Data\User::HAS_CHILDREN_NO ?>"> 未育过&nbsp;&nbsp;&nbsp;&nbsp;
						</label>
					</div>
					<div class="clearfix"></div>
					<div class="form-group">
						<label>饮食习惯：</label>
						<label>
							<input type="checkbox" name="eatingHabits[]" <?php echo in_array(\Data\User::EATING_HABITS_DOG_FOOD, explode(',', $userInfo['EatingHabits'])) ? 'checked' : '' ?> value="<?php echo \Data\User::EATING_HABITS_DOG_FOOD ?>"> 狗粮&nbsp;&nbsp;&nbsp;&nbsp;
						</label>
						<label>
							<input type="checkbox" name="eatingHabits[]" <?php echo in_array(\Data\User::EATING_HABITS_DOG_DIY, explode(',', $userInfo['EatingHabits'])) ? 'checked' : '' ?> value="<?php echo \Data\User::EATING_HABITS_DOG_DIY ?>"> 自制&nbsp;&nbsp;&nbsp;&nbsp;
						</label>
						<label>
							<input type="checkbox" name="eatingHabits[]" <?php echo in_array(\Data\User::EATING_HABITS_DOG_MIXED, explode(',', $userInfo['EatingHabits'])) ? 'checked' : '' ?> value="<?php echo \Data\User::EATING_HABITS_DOG_MIXED ?>"> 杂食
						</label>
					</div>
					<div class="clearfix"></div>
					<div class="form-group">
						<label>体重：</label>
						<div class="input-group">
							<input type="number" value="<?php echo $userInfo['Weight'] ? $userInfo['Weight'] : '' ?>" name="weight" class="form-control" placeholder="体重">
							<div class="input-group-addon">千克</div>
						</div>
					</div>
					<div class="clearfix"></div>
					<div class="form-group">
						<label>体长：</label>
						<div class="input-group">
							<input type="number" value="<?php echo $userInfo['Length'] ? $userInfo['Length'] : '' ?>" name="length" class="form-control" placeholder="体长">
							<div class="input-group-addon">厘米</div>
						</div>
					</div>
					<div class="clearfix"></div>
					<div class="form-group">
						<label>肩高：</label>
						<div class="input-group">
							<input type="number" value="<?php echo $userInfo['Height'] ? $userInfo['Height'] : '' ?>" name="height" class="form-control" placeholder="肩高">
							<div class="input-group-addon">厘米</div>
						</div>
					</div>
					<div class="clearfix"></div>
					<div class="form-group">
						<label>毛色：</label>
						<input type="text" value="<?php echo $userInfo['Color'] ?>" name="color" class="form-control" placeholder="毛色">
					</div>
					<div class="clearfix"></div>
					<div class="form-group">
						<label>简介：</label>
						<textarea name="desc" class="form-control desc" rows="3" placeholder="介绍一下自己吧..."><?php echo $userInfo['Desc'] ?></textarea>
					</div>
					<div class="clearfix"></div>
					<a href="/home.html" class="btn btn-default">取消</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<button type="submit" class="btn btn-success">提交</button>
				</form>
			</div>
		</div>
	</div>
</div>
<?php $this->import('Footer') ?>
<div class="modal fade" id="js-dog-edit-photo">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
				<h4 class="modal-title">编辑头像</h4>
			</div>
			<div class="modal-body">
				<center>
					<img class="js-edit-src" src="/Resource/images/load.gif" style="max-width: 100%; max-height: 400px;">
				</center>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				<button type="button" onclick="$('#js-coords').submit()" class="btn btn-primary">保存</button>
			</div>
		</div><!-- /.modal-content -->
	</div><!-- /.modal-dialog -->
</div>
<form id="js-coords" action="" method="post" style="display: none;">
	<input type="hidden" id="x" name="x">
	<input type="hidden" id="y" name="y">
	<input type="hidden" id="w" name="w">
	<input type="hidden" id="h" name="h">
	<input type="hidden" id="width" name="width">
	<input type="hidden" name="file" value="">
	<input class="cxbtn" type="submit" value="裁剪图像">
</form>
<script>
	seajs.init();
</script>